<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>会员详情</title>
		<link type="text/css" rel="stylesheet" href="/fontsawesome/css/font-awesome.css"/>
		<link type="text/css" rel="stylesheet" href="/css/datepicker.css"/>
		<link type="text/css" rel="stylesheet" href="/css/style.css"/>

		<style>
			.buttom{
				margin-bottom: 200px;
			}

		</style>
	</head>
	<body>
		<div class="main_box">
			<div class="cont_box">
                <div th:class="${updateClass }" th:text="${updateMsg }"></div>
				<h2 th:text="${providerInfo?.name}"></h2>
				<form method="post" id="provider_form">
					<ul class="addpro_box">
						<li>
							<label>公司编号：</label>
							<input type="text" name="id" id="id" th:value="${providerInfo?.id}" readonly/>
						</li>
						<li>
							<label>公司名称：</label>
							<input type="text" name="name" id="name" th:value="${providerInfo?.name}" readonly/>
						</li>
						<li>
							<label>法人：</label>
							<input type="text" name="boss" id="boss" th:value="${providerInfo?.boss}" readonly/>
						</li>
						<li>
							<label>手机号：</label>
							<input type="text" name="phone" id="phone" th:value="${providerInfo?.phone}" readonly/>
						</li>
						<li>
							<label>传真号：</label>
							<input type="text" name="faxNum" id="faxNum" th:value="${providerInfo?.faxNum}" readonly/>
						</li>
						<li>
							<label class="f_left">成立时间：</label>
							<div class="date_box">
								<input type="text" name="createDay" id="start_date" th:value="${#dates.format(providerInfo?.createDay,'yyyy-MM-dd')}" readonly/>
							</div>
						</li>
						<li>
							<label>地址：</label>
							<input type="text" name="address" id="address" th:value="${providerInfo?.address}" readonly/>
						</li>
						<li>
							<label>备注：</label>
							<textarea rows="4" name="description" id="description" th:text="${providerInfo?.description}" readonly></textarea>
						</li>
					</ul>
					<div class="probtn_box clearfix">
						<input type="button" value="编辑" class="btn blue_btn"/>
						<span>&nbsp;&nbsp;&nbsp;</span>
						<input type="button" value="保存修改" class="btn blue_btn .submit"/>
						<span>&nbsp;&nbsp;&nbsp;</span>
						<input type="button" value="返回" class="btn blue_btn"/>
					</div>
				</form>
				<!--大礼包情况-->
				<div class="user_detail buttom">
					<h2><span></span>商品列表</h2>
					<table border="0" cellspacing="0" cellpadding="0" class="table">
						<thead>
							<tr>
								<th>商品编号</th>
								<th>商品名称</th>
								<th>商品类型</th>
								<th>商品库存</th>
								<th>批发价格</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody th:if="${not #lists.isEmpty(providerInfo?.commodityList)}">
						<tr th:each="t,line : ${providerInfo?.commodityList}">
							<td><span th:text="${t?.id }"></span></td>
							<td><span th:text="${t?.name }"></span></td>
							<td><span th:text="${t?.commodityType.stateName }"></span></td>
							<td><span th:text="${t?.amount}"></span></td>
							<td><span th:text="${t?.price }"></span></td>
							<td th:id="${t?.id}" th:name="${t?.providerId}">
								<a href="javascript:void(0);" class="table_btn table_info detail_btn">
									<i class="fa fa-eye"></i>
									<span>查看</span>
								</a>
								<a href="javascript:void(0);" class="table_btn table_edit edit_btn">
									<i class="fa fa-edit"></i>
									<span>修改</span>
								</a>
								<a href="javascript:void(0);" class="table_btn table_del del_btn">
									<i class="fa fa-recycle"></i>
									<span>删除</span>
								</a>
							</td>
						</tr>
						</tbody>
						<tbody th:if="${#lists.isEmpty(providerInfo?.commodityList)}">
							<tr class="text">
								<td colspan="6"><span >没有商品，快去添加吧</span></td>
							</tr>
						</tbody>
					</table>
					<div class="clearfix" style="margin-top:20px;">
						<input type="button" value="添加商品" class="btn line_btn">
					</div>
				</div>

			</div>
		</div>
		<!--javascript include-->
		<script src="/js/jquery-2.2.1.min.js"></script>
		<script src="/js/jquery.dataTables.min.js"></script>
		<script src="/js/bootstrap-datepicker.js"></script>
		<script src="/js/jquery.validate.min.js"></script>
		<script src="/js/other.js"></script>
		<script src="/js/jump.js"></script>
		<script>
			$(".update-suc,.update-err").slideUp(1000*2);
		</script>

		<script type="text/javascript">

			$(":button[value='保存修改']").hide();

			$(":button[value='编辑']").bind("click",function () {
				$(this).hide();
				$(":button[value='保存修改']").show();
				$("#name,#boss,#faxNum,#phone,#description,#address").removeAttr("readonly");

				$(":button[value='保存修改']").bind("click",function () {
					toJump1(
					    "/provider/update",
                        {
                            id:$("#id").val(),
                            name:$("#name").val(),
                            boss:$("#boss").val(),
                            faxNum:$("#faxNum").val(),
                            phone:$("#phone").val(),
                            description:$("#description").val(),
                            address:$("#address").val(),
                            createDay:$("#start_date").val()
                        }
                    )
				});
			});

			$(":button[value='返回']").bind("click",function () {
				toJump1("/provider/query");
			});


			$(function(){
				$("body").tipWindow({method:"edit",Class:".detail_btn",even:"click", orderId:"id",
					Twidth:"600",Theight:"400",tipTit:"商品信息",editUrl:"/commodity/view"});
				$("body").tipWindow({method:"edit",Class:".edit_btn",even:"click",orderId:"id",
					Twidth:"550",Theight:"530",tipTit:"修改商品信息",editUrl:"/commodity/updatePage"});
				$("body").tipWindow({method:"edit",Class:".line_btn",even:"click", dataId:[[${providerInfo?.id}]],
					Twidth:"550",Theight:"530",tipTit:"添加商品",editUrl:"/commodity/addPage"});
				$("body").tipWindow({method:"delete",Class:".del_btn",even:"click",deleteTxt:"确认要删除该商品吗？",
					Twidth:"400",Theight:"180",delUrl:"/commodity/delete",providerId:"[[${providerInfo?.id}]]"});//delUrl 退单请求地址
			});
		</script>

	</body>
</html>
